/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "sclgtbprovinc")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sclgtbprovinc.findAll", query = "SELECT s FROM Sclgtbprovinc s"),
    @NamedQuery(name = "Sclgtbprovinc.findBySclgtbprovincid", query = "SELECT s FROM Sclgtbprovinc s WHERE s.sclgtbprovincid = :sclgtbprovincid"),
    @NamedQuery(name = "Sclgtbprovinc.findByNombre", query = "SELECT s FROM Sclgtbprovinc s WHERE s.nombre = :nombre"),
    @NamedQuery(name = "Sclgtbprovinc.findByObservaciones", query = "SELECT s FROM Sclgtbprovinc s WHERE s.observaciones = :observaciones")})
public class Sclgtbprovinc implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "sclgtbprovincid")
    private Integer sclgtbprovincid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @JoinColumn(name = "sclgtbzonaid", referencedColumnName = "sclgtbzonaid")
    @ManyToOne(optional = false)
    private Sclgtbzona sclgtbzonaid;
    @JoinColumn(name = "sclgtbpaisid", referencedColumnName = "sclgtbpaisid")
    @ManyToOne(optional = false)
    private Sclgtbpais sclgtbpaisid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sclgtbprovincid")
    private Collection<Sclgtbciudad> sclgtbciudadCollection;

    public Sclgtbprovinc() {
    }

    public Sclgtbprovinc(Integer sclgtbprovincid) {
        this.sclgtbprovincid = sclgtbprovincid;
    }

    public Sclgtbprovinc(Integer sclgtbprovincid, String nombre) {
        this.sclgtbprovincid = sclgtbprovincid;
        this.nombre = nombre;
    }

    public Integer getSclgtbprovincid() {
        return sclgtbprovincid;
    }

    public void setSclgtbprovincid(Integer sclgtbprovincid) {
        this.sclgtbprovincid = sclgtbprovincid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public Sclgtbzona getSclgtbzonaid() {
        return sclgtbzonaid;
    }

    public void setSclgtbzonaid(Sclgtbzona sclgtbzonaid) {
        this.sclgtbzonaid = sclgtbzonaid;
    }

    public Sclgtbpais getSclgtbpaisid() {
        return sclgtbpaisid;
    }

    public void setSclgtbpaisid(Sclgtbpais sclgtbpaisid) {
        this.sclgtbpaisid = sclgtbpaisid;
    }

    @XmlTransient
    public Collection<Sclgtbciudad> getSclgtbciudadCollection() {
        return sclgtbciudadCollection;
    }

    public void setSclgtbciudadCollection(Collection<Sclgtbciudad> sclgtbciudadCollection) {
        this.sclgtbciudadCollection = sclgtbciudadCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sclgtbprovincid != null ? sclgtbprovincid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sclgtbprovinc)) {
            return false;
        }
        Sclgtbprovinc other = (Sclgtbprovinc) object;
        if ((this.sclgtbprovincid == null && other.sclgtbprovincid != null) || (this.sclgtbprovincid != null && !this.sclgtbprovincid.equals(other.sclgtbprovincid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Sclgtbprovinc[ sclgtbprovincid=" + sclgtbprovincid + " ]";
    }
    
}
